home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!zodiac!szh
- From: szh@zcon.com (Syed Zaeem Hosain)
- Subject: Re: CONVERTING INTEGER TO ASCII??????
- Message-ID: <1996Mar16.013541.7285@zcon.com>
- Sender: szh@zcon.com (Syed Zaeem Hosain)
- Nntp-Posting-Host: zodiac
- Reply-To: szh@zcon.com
- Organization: Z Consulting Group
- References: <4ic5kp$d0g@athos.cc.bellcore.com>
- Date: Sat, 16 Mar 1996 01:35:41 GMT
-
- In article <4ic5kp$d0g@athos.cc.bellcore.com>, "Sandeep V. Tamhankar" <stamhank@notes.cc.bellcore.com> writes:
- >Mr. Seebach, I think you've been reading this group for too long and have
- >become bitter about "beginners'" questions.
-
- *Nobody* is bitter about beginners questions, including Peter. But
- there is etiquette to follow for any newsgroup, and one of the simplest
- and easiest ones is to read the FAQ for the newsgroup before doing any
- posting in it! :-)
-
- The point is that if anybody reads the FAQ, they will see the answer to
- the following question:
-
- 13.1: How can I convert numbers to strings (the opposite of atoi)? Is
- there an itoa function?
-
- Isn't this act (reading the FAQ, that is) quicker and easier than to
- post the question here (over and over and over and over and over again,
- ad nauseam)? Not to mention get a quicker answer without waiting for
- someone to respond? And also not wasting the time of the people reading
- the newsgroup?
-
- I try to be polite, but some days I just want to throw things at my
- system when I see the *same* question for the hundredth time. Stick
- around long enough and you will feel the same. Then you will get a
- good feeling for where Peter is coming from! :-)
-
-
- >Granted that converting an
- >integer to ASCII is really easy, but people who've just started
- >programming in C need time to get used to the language and its immense
- >functionality. I didn't learn about sprintf for a very long time after I
- >began programming in C. Anyway, I'm going off the point.
- >
- >Another way to convert integer to ASCII is to add char '0' to your
- >integer. Like so:
- >
- > int asc;
- > asc= known_int + '0';
- >
- >This way, you don't have to load any function and there is no overhead.
-
- But this does not make any sense, does it? If I have a known_int with
- value, oh, lets say, 2134, just how does adding '0' to it convert it
- to ASCII?
-
- Z
-
-
- --
- -------------------------------------------------------------------------
- | Syed Zaeem Hosain P. O. Box 610097 (408) 441-7021 |
- | Z Consulting Group San Jose, CA 95161 szh@zcon.com |
- -------------------------------------------------------------------------
-